AR=arm-linux-ar
LD=arm-linux-ld
CC=arm-linux-gcc
CFLAGS= -Wall -march=armv4 -mtune=arm9tdmi #-msoft-float

SDL_LIB = ../../../libSDL
SDL_CFLAGS = -I$(SDL_LIB) -I$(SDL_LIB)/include  -I./
LDFLAGS +=  -ISDL -lpthread 

OBJ1 = mpeg4_main.o ratecontrol.o
OBJ2 = jpeg_main.o
OBJ3 = utils.o ratecontrol.o libSDL.a
OBJ4 = mp4enc.o ratecontrol.o
OBJ5 = jpgenc.o
OBJ6 = tcounter.o

all:  jpeg_main mpeg4_main mp4enc jpgenc tcounter

jpeg_main: $(OBJ2)
	$(CC) -lc -lm  $(OBJ2) -o jpeg_main
	cp jpeg_main /tmp
	cp jpeg_main /usr/src/FSM-Server_v1.1/fsm-source-server/binary/	

mpeg4_main: $(OBJ1)
	$(CC) -lc -lm  $(OBJ1) -o mpeg4_main
	cp mpeg4_main /tmp
	
mp4enc:$(OBJ4)
	$(CC) -lc -lm  $(OBJ4) -o mp4enc
	cp mp4enc /tmp
jpgenc: $(OBJ5)
	$(CC) -lc -lm  $(OBJ5) -o jpgenc
	cp jpgenc /tmp
	
tcounter: $(OBJ6)
	$(CC) -lc -lm  $(OBJ6) -o tcounter
	cp tcounter /tmp	
	
%.o: %.c
	$(CC) $(CFLAGS) $(SDL_CFLAGS) -c -o $@ $<
	
Makefile.depend depend:
	arm-linux-gcc $(CFLAGS) $(SDL_CFLAGS) -MM -MG *.c > Makefile.depend
	
clean:
	rm -f *.o
	rm -f mpeg4_main
	rm -f jpeg_main
	rm -f mp4enc
	rm -f jpgenc
	rm -f tcounter
